package com.kitchen.ui.button
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class ICentenButton extends Sprite
	{
		protected var bitMap:Bitmap;
		protected var bitWidth:Number;
		protected var bitHeight:Number;
		
		public function ICentenButton(bitMapData:BitmapData)
		{
			super();
			this.bitMap = new Bitmap(bitMapData);
			this.addChild(this.bitMap);
			this.useHandCursor = true;
			this.buttonMode = true;
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
			this.addEventListener(MouseEvent.MOUSE_UP, onMouseOver);
		}
		
		protected function drawMask(width:Number, height:Number):void{
			this.bitHeight = height;
			this.bitWidth = width;
			var shape:Shape = new Shape();
			shape.graphics.lineStyle(1, 0xffffff, 0.001);
			shape.graphics.beginFill(0xffffff, 1);
			shape.graphics.drawRect(-(width/2), -(height/2), width, height);
			shape.graphics.endFill();
			this.mask = shape;
			this.addChild(shape);
		}
		
		protected function offsetX(ox:Number):void{
			this.bitMap.x = -(ox+this.bitWidth/2);
		}
		
		protected function offsetY(oy:Number):void{
			this.bitMap.y = -(oy+this.bitHeight/2);
		}
		
		protected function onMouseOver(me:MouseEvent):void{
			
		}
		
		protected function onMouseDown(me:MouseEvent):void{
			
		}
		
		protected function onMouseOut(me:MouseEvent):void{
			
		}

	}
}